package gipfProject.games.zertz.data;

public class PieceData {

	public static final int INVALID = -2, EMPTY = -1, 
		WHITE = 0, GRAY = 1, BLACK = 2, ALL = 3;

	private int type;
	private boolean highlight;

	/**
	 * Creates a new piece By default the piece will be type:INVALID
	 */
	public PieceData() {
		type = INVALID;
		highlight = false;
	}
	
	public void setHighlight(){
		highlight = true;
	}
	
	public void clearHighlight(){
		highlight = false;
	}
	
	public boolean isHighlighted(){
		return highlight;
	}

	public void setType(int newType) {
		type = newType;
	}

	public void setToEmpty() {
		type = EMPTY;
	}

	public void setToInvalid() {
		type = INVALID;
	}

	public boolean isEmpty() {
		return (type == EMPTY);
	}

	public boolean isValid() {
		return (type != INVALID);
	}
	
	public boolean isMarble() {
		return (type == WHITE || type == GRAY || type == BLACK);
	}

	public int getType() {
		return type;
	}
	
	/**
	 * Find the image file name for this piece
	 * 
	 * @return the hash-table key for the ResourceLoader
	 */
	public String imageFile() {
		if (type == WHITE) {
			return "WhiteMarble";
		} else if (type == GRAY) {
			return "GrayMarble";
		} else if (type == BLACK) {
			return "BlackMarble";
		} else {
			return null;
		}
	}
}
